//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Text;
using OpenLS.Spreadsheet.Expressions;
using OpenLS.Spreadsheet.Parsing;

namespace OpenLS.Spreadsheet
{
    class R1C1NamingConvention : CellNamingConvention
    {
        public override bool TryParse(string s, out CellAddress result)
        {

            if (s == null || s.Length == 0)
            {
                result = new CellAddress();
                return false;
            }


            throw new NotImplementedException();
        }

        public override bool TryParseColumn(string s, out int columnIndex, out int length)
        {
            throw new NotImplementedException();
        }

        public override bool RowBeforeColumn
        {
            get
            {
                return true;
            }
        }

        internal override List<ReferenceToken> ParseRangeReference(ExpressionParser parser)
        {
            throw new NotImplementedException();
        }

        internal override CellReferenceToken ParseCellReference(string text)
        {
            throw new NotImplementedException();
        }

        public override string GetText(CellReferenceToken token)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("R");
            if (!token.LockRow)
                sb.Append('[');
            sb.Append(token.Row + 1);
            if (!token.LockRow)
                sb.Append(']');

            sb.Append("C");
            if (!token.LockColumn)
                sb.Append('[');
            sb.Append(token.Column + 1);
            if (!token.LockColumn)
                sb.Append(']');

            return sb.ToString();
        }

        public override string GetColumnName(int index, bool locked)
        {
            throw new NotImplementedException();
        }

        public override string GetRowName(int index, bool locked)
        {
            throw new NotImplementedException();
        }
    }

}
